import axios from 'axios'; // axios方式进行同步数据请求

const baseUrl = 'http://api.ruohan.store.ruohan.store/'

// 轮播图数据获取
export function getRecommend() {
    return axios.get("http://api.ruohan.store/banner?type=2")
}

//歌单数据获取
export function getDiscList(limit = 10) {
    return axios.get(`http://api.ruohan.store/top/playlist?limit=${limit}&order=hot`)
}
//歌手单曲获取
export function getSongListBySinger(id) {
    return axios.get(`http://api.ruohan.store/artists?id=${id}`)
}
//歌单详情页获取
export function getDiscSongLists(id) {
    return axios.get(`http://api.ruohan.store/playlist/detail?id=${id}`)
}
//歌手列表获取
export function getArtistLists(id, limit, firstName) {
    return axios.get(`http://api.ruohan.store/artist/list?cat=${id}&limit=${limit}&initial=${firstName}${firstName}`)
}
//排行榜获取
export function getHotSongLists(id) {
    return axios.get(`http://api.ruohan.store/top/list?idx=${id}`)
}

//根据关键词搜索歌曲
export function getSearchSongLists(keywords) {
    return axios.get(`http://api.ruohan.store/search?keywords=${keywords}`)
}
//获取热搜简略列表
export function getSearchHotSongs() {
    return axios.get(`http://api.ruohan.store/top/song?type=0`)
}

//判断歌曲是否能够播放（权限）
export function checkSongsOpened(id) {
    return axios.get(`http://api.ruohan.store/check/music?id=${id}`)
}
//获取歌曲的详细信息（链接，图片）

export function getSongsUrl(id) {
    return axios.get(`http://api.ruohan.store/song/url?id=${id}`)
}

//获取歌曲详细信息
export function getSongsDetails(id) {
    return axios.get(`http://api.ruohan.store/song/detail?ids=${id}`)
}
//单曲歌词的获取
export function getSongsLyric(id) {
    return axios.get(`http://api.ruohan.store/lyric?id=${id}`)
}